package com.disapand.dingdang.configuration

import cn.dev33.satoken.interceptor.SaRouteInterceptor
import cn.dev33.satoken.jwt.StpLogicJwtForStyle
import cn.dev33.satoken.stp.StpLogic
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

/**
 * @Author disapand
 * @Date 2022/2/21 - 22:44 - 星期一
 */
@Configuration
class SaTokenConfiguration : WebMvcConfigurer {

//    override fun addInterceptors(registry: InterceptorRegistry) {
//        registry.addInterceptor(SaRouteInterceptor())
//            .addPathPatterns("/**")
//            .excludePathPatterns("/druid/**", "/druid/", "/error")
//    }

    /**
     * sa-token 采用 style 模式整合 jwt
     */
    @Bean
    fun getStpLogicJwt(): StpLogic {
        return StpLogicJwtForStyle()
    }
}